package com.soft.service;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.Assert;

import com.soft.entity.Banji;
import com.soft.service.BanjiService; // 补充 DeptService 的导入（根据注入逻辑推断）

@SpringBootTest
public class BanjiServiceTest {

    @Autowired
    private BanjiService banjiService;

    @Test
    public void queryAllTest() {
        List<Banji> banjiList = banjiService.queryAll();
        Assert.notEmpty(banjiList, "为空");
        Assert.isTrue(banjiList.size()>0, "数据有值");
        for (int i = 0; i < banjiList.size(); i++) {
            System.out.println(banjiList.get(i).getBanjiBanjihao());
        }
    }
    //@Test
    public void queryByLocTest()
    {
    	List<Banji> banjiList = banjiService.queryByLoc("王五");
    	Assert.isTrue(banjiList.size() == 3, "根据lco进行查询结果的数据不对");
    }
    //@Test
    public void insertOneTest() {
    	int num = banjiService.insertOne("40", "王明");
    	Assert.isTrue(num == 1, "增加数据错误");
    }
    //@Test
    public void deleteByIdTest() {
    	int num = banjiService.deleteById("3");
    	Assert.isTrue(num == 1, "删除数据错误");
    }
    //@Test
    public void deleteByNameTest()
    {
    	int num = banjiService.deleteByName("30");
    	Assert.isTrue(num == 2, "删除数据错误");
    }
    //@Test
    public void updateByDnoTest()
    {
    	int num = banjiService.updateByDno("12");
    	Assert.isTrue(num == 2, "更新数据错误");
    }
}